<%@page import="java.util.Date"%>
<%@page import="classes.Conexao"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page buffer="500kb" autoFlush="false" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>NutriWeb - Praticando alimentação saudável</title>
    </head>
    <body style="background-image: url('a_data/nutriweb_logo_water2.png'); background-repeat: no-repeat; background-attachment: fixed; background-position: right bottom">
        <script type="text/javascript">   
            function InvalidMsg(textbox) {

                if (textbox.value == '') {
                    textbox.setCustomValidity('Favor preencher este campo!');
                }
                else if(textbox.validity.typeMismatch){
                    textbox.setCustomValidity('Favor preencher com um valor válido!');
                }
                else {
                    textbox.setCustomValidity('');
                }
                return true;
            }
        </script>   
        <%  
            request.setCharacterEncoding("UTF-8");
            
            String url = request.getRequestURL().toString();
            String periodo = "";
            String SQL = null;
            
            SimpleDateFormat dtf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
            SimpleDateFormat odtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            SimpleDateFormat tf = new SimpleDateFormat("HH");            
            
            if (session.getAttribute("nm_email") != null){
                periodo = (Integer.parseInt(tf.format(new Date())) < 12 ? "Bom dia" : (Integer.parseInt(tf.format(new Date())) < 18 ? "Boa tarde" :  "Boa noite" ));
            
            } else if (session.getAttribute("nm_email") == null && (!url.contains("inicio.jsp") && !url.contains("sobre.jsp"))) {
                response.sendRedirect(request.getContextPath() + "/login.jsp");
                return;
            }
        %>  
                <header class="header header-two">
                    <div class="header-wrapper">
                        <div class="container">
                            <div class="row">
                                <div class="col-xs-6 col-md-2 col-lg-3 logo-box">
                                    <div class="logo">
                                        <a href="inicio.jsp">
                                            <img src="a_data/nutriweb_logo.jpg" class="logo-img" alt="">
                                        </a>
                                    </div>
                                </div><!-- .logo-box -->

                                <div class="col-xs-6 col-md-10 col-lg-9 right-box">
                                    <div class="right-box-wrapper">

                                        <div class="primary">
                                            <div class="navbar navbar-default" role="navigation">

                                                <button type="button" class="navbar-toggle btn-navbar collapsed" data-toggle="collapse" data-target=".primary .navbar-collapse">
                                                    <span class="text">Menu</span>
                                                    <span class="icon-bar"></span>
                                                    <span class="icon-bar"></span>
                                                    <span class="icon-bar"></span>
                                                </button>
                                                <nav style="height: 0px;" class="navbar-collapse collapse">
                                                    <ul class="nav navbar-nav navbar-center">
                                                        <li >
                                                            <a href="inicio.jsp">Início</a>
                                                        </li>
                                                        <% if (session.getAttribute("nm_email") != null) {%>
                                                        <li >
                                                            <a href="beber.jsp">Beber Água </a>
                                                        </li>

                                                        <li >
                                                            <a href="treino.jsp">Treinar</a>
                                                        </li>
                                                        <li class="parent">
                                                            <a>Refeições</a>
                                                            <ul class="sub">
                                                                <li >
                                                                    <a href="cafe_manha.jsp">Café da Manhã</a>
                                                                </li>
                                                                <li >
                                                                    <a href="lanche_manha.jsp">Lanche da Manhã</a>
                                                                </li>
                                                                <li >
                                                                    <a href="almoco.jsp">Almoço</a>
                                                                </li>
                                                                <li >
                                                                    <a href="lanche_tarde.jsp">Lanche da Tarde</a>
                                                                </li>
                                                                <li >
                                                                    <a href="jantar.jsp">Jantar</a>
                                                                </li>

                                                            </ul>
                                                        </li>	

                                                        <li class="parent">
                                                            <a>Alimentos</a>
                                                            <ul class="sub">
                                                                <% if (session.getAttribute("ic_admin") != null && session.getAttribute("ic_admin").toString().equalsIgnoreCase("true")) {%>
                                                                <li >
                                                                    <a href="cadastrar_alimento.jsp">Cadastrar</a>
                                                                </li>
                                                                <%}%>                                                                

                                                                <li >
                                                                    <a href="consultar_alimento.jsp">Consultar</a>
                                                                </li>
                                                            </ul>
                                                        </li>
                                                        <% //if (session.getAttribute("nm_email") != null) {%>
                                                        <li class="parent">
                                                            <a>Perfil</a>
                                                            <ul class="sub">
                                                                <li >
                                                                    <a href="perfil.jsp">Dados Cadastrais</a>
                                                                </li>
                                                                <li >
                                                                    <a href="relatoriomensal.jsp">Relatório Mensal</a>
                                                                </li>
                                                            </ul>
                                                        </li>
                                                        <%//}%>
                                                        <%}%>
                                                        <li >
                                                            <a href="sobre.jsp">Sobre</a>
                                                        </li>
                                                        <li class="item-danger item-bg text-danger">
                                                            <% if (session.getAttribute("nm_email") != null) {
                                                                String login = session.getAttribute("nm_email").toString();%>
                                                            <a href="<%=request.getContextPath()%>/login.jsp?logoff">Sair</a>
                                                            <%} else {%>
                                                            <a href="<%=request.getContextPath()%>/login.jsp">Login</a>
                                                            <%}%>					 
                                                        </li>

                                                    </ul>
                                                </nav>
                                            </div>
                                        </div><!-- .primary -->
                                    </div>
                                </div>

                                <div class="phone-active col-sm-9 col-md-9">
                                    <a href="#" class="close"><span>close</span>×</a>
                                    <span class="title">Call Us</span> <strong>+1 (777) 123 45 67</strong>
                                </div>
                                <div class="search-active col-sm-9 col-md-9">
                                    <a href="#" class="close"><span>close</span>×</a>
                                    <form name="search-form" class="search-form">
                                        <input class="search-string form-control" placeholder="Search here" name="search-string" type="search">
                                        <button class="search-submit">
                                            <svg xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
                                            <path fill="#231F20" d="M12.001,10l-0.5,0.5l-0.79-0.79c0.806-1.021,1.29-2.308,1.29-3.71c0-3.313-2.687-6-6-6C2.687,0,0,2.687,0,6
                                                  s2.687,6,6,6c1.402,0,2.688-0.484,3.71-1.29l0.79,0.79l-0.5,0.5l4,4l2-2L12.001,10z M6,10c-2.206,0-4-1.794-4-4s1.794-4,4-4
                                                  s4,1.794,4,4S8.206,10,6,10z"></path>
                                            <image src="img/png-icons/search-icon.png" alt="" width="16" height="16" style="vertical-align: top;">
                                            </image></svg>
                                        </button>
                                    </form>
                                </div>


                            </div><!--.row -->
                        </div>
                    </div><!-- .header-wrapper -->
                </header><!-- .header -->
    </body>
</html>
